<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    protected $commands = [
        \App\Console\Commands\UpdateAccessToken::class,
        \App\Console\Commands\updateUserMoney::class,
        \App\Console\Commands\CancleOrder::class,
        \App\Console\Commands\UserUpgrade::class,
        \App\Console\Commands\UserCopy::class,
        \App\Console\Commands\updateUserTeamMoney::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();
        //每一个半小时更新一次
       // $schedule->job(new UpdateAccessToken())->hourlyAt(30);
        $schedule->command('UpdateAccessToken')->hourlyAt(30);

        $schedule->command('updateUserMoney')->everyMinute();

        $schedule->command('CancleOrder')->everyFifteenMinutes();
        //复制用户的业绩
        $schedule->command('UserCopy')->everyMinute();

        //$schedule->command('updateUserTeamMoney')->everyMinute();
        //$schedule->command('UserUpgrade')->hourly();
        //
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
